import {Component, OnInit} from '@angular/core';
import {BladeService} from '../../../shared/blade.service';
import {BladeData} from '../../../shared/blade/blade-data';
import {RoleListComponent} from './role-list/role-list.component';
import {Observable} from 'rxjs/Observable';

@Component({
  selector: 'app-role',
  templateUrl: './role.component.html',
  styleUrls: ['./role.component.css'],
  providers: [BladeService]
})
export class RoleComponent implements OnInit {

  constructor(public bladeService: BladeService) {
  }

  ngOnInit() {
    this.createRoleListBlade()
  }


  /**
   * 创建角色列表弹出层
   *
   * @memberof RoleComponent
   */
  createRoleListBlade() {
    let data: BladeData = new BladeData();
    data.id = 'RoleList';
    data.title = '角色';
    data.subtitle = '角色列表';
    data.isClosingDisabled = true;
    let roleListBlade = this.bladeService.createBlade(RoleListComponent, data);
    this.bladeService.showBlade(roleListBlade);
  }

  /**
   * 是否可以离开
   *
   * @returns {(boolean | Observable<boolean> | Promise<boolean>)}
   * @memberof RoleComponent
   */
  canDeactivate(): boolean | Observable<boolean> | Promise<boolean> {
    return true;
  }
}


// WEBPACK FOOTER //
// ./src/app/module/admin/role/role.component.ts
